<alert type="success">{{messages[index]}}</alert>

<div *ngIf="index !== messages.length -1; else elseBlock">
  <button class="btn btn-primary" (click)="changeText()">Change text</button>
</div>
<ng-template #elseBlock>
  <button class="btn btn-primary" (click)="index = 0">Reset</button>
</ng-template>
